import userAxios from './request';

export let loginReq = (username, pwd) => (userAxios({
    url: "/admin/login",
    method: "post",
    data: {
        username,
        pwd
    }
}))

// div.index = 1;
// div.setAttribute('key','value');
// <div data-abc="123"></div>
// div.dataset.abc = 456;


export let usersReq = (num, limit) => userAxios({
    url: `/admin/user/${num}/${limit}`,
});

export let delUserReq = (_id) => userAxios({
    url: `/admin/user/${_id}`,
    method: "delete"
})

export let addUserReq = (data) => userAxios({
    url: "/admin/user",
    method: "post",
    data
});

export let getUserReq = id => userAxios({
    url: "/admin/user",
    params: {
        id
    }
})

export let updateUserReq = data => userAxios({
    url: "/admin/user",
    method: "put",
    data
})

export let getLoginUserReq = () => userAxios({
    url: "/admin/info",
})